if(WITH_CUDA)
  cuda_add_executable(cuda_allocator_test cuda_allocator_test.cu)
  cuda_add_executable(cuda_array_test     cuda_array_test.cu)
  cuda_add_executable(soa_array_cuda_test soa_array_cuda_test.cu)
  cuda_add_executable(soa_grid_cuda_test  soa_grid_cuda_test.cu)
endif()
add_executable(aligned_allocator_test               aligned_allocator_test.cpp)
add_executable(api_traits_test                      api_traits_test.cpp)
add_executable(estimate_optimum_short_vec_type_test estimate_optimum_short_vec_type_test.cpp)
add_executable(loop_peeler_test                     loop_peeler_test.cpp)
add_executable(preprocessor_test                    preprocessor_test.cpp)
add_executable(short_vec_test                       short_vec_test.cpp short_vec_additional_test.cpp)
add_executable(streaming_short_vec_test             streaming_short_vec_test.cpp)
add_executable(soa_array_test                       soa_array_test.cpp)
add_executable(soa_grid_test                        soa_grid_test.cpp)
add_executable(soa_vector_test                      soa_vector_test.cpp)

if(WITH_CUDA)
  add_custom_target(run_cuda_allocator_test                echo "running cuda_allocator_test"                  && /bin/sh -c "${UNITEXEC} ./cuda_allocator_test")
  add_custom_target(run_cuda_array_test                    echo "running cuda_array_test"                      && /bin/sh -c "${UNITEXEC} ./cuda_array_test")
  add_custom_target(run_soa_array_cuda_test                echo "running soa_array_cuda_test"                  && /bin/sh -c "${UNITEXEC} ./soa_array_cuda_test")
  add_custom_target(run_soa_grid_cuda_test                 echo "running soa_grid_cuda_test"                   && /bin/sh -c "${UNITEXEC} ./soa_grid_cuda_test")
endif()
add_custom_target(run_aligned_allocator_test               echo "running aligned_allocator_test"               && /bin/sh -c "${UNITEXEC} ./aligned_allocator_test")
add_custom_target(run_api_traits_test                      echo "running api_traits_test"                      && /bin/sh -c "${UNITEXEC} ./api_traits_test")
add_custom_target(run_estimate_optimum_short_vec_type_test echo "running estimate_optimum_short_vec_type_test" && /bin/sh -c "${UNITEXEC} ./estimate_optimum_short_vec_type_test")
add_custom_target(run_loop_peeler_test                     echo "running loop_peeler_test"                     && /bin/sh -c "${UNITEXEC} ./loop_peeler_test")
add_custom_target(run_preprocessor_test                    echo "running preprocessor_test"                    && /bin/sh -c "${UNITEXEC} ./preprocessor_test")
add_custom_target(run_short_vec_test                       echo "running short_vec_test"                       && /bin/sh -c "${UNITEXEC} ./short_vec_test")
add_custom_target(run_streaming_short_vec_test             echo "running streaming_short_vec_test"             && /bin/sh -c "${UNITEXEC} ./streaming_short_vec_test")
add_custom_target(run_soa_array_test                       echo "running soa_array_test"                       && /bin/sh -c "${UNITEXEC} ./soa_array_test")
add_custom_target(run_soa_grid_test                        echo "running soa_grid_test"                        && /bin/sh -c "${UNITEXEC} ./soa_grid_test")
add_custom_target(run_soa_vector_test                      echo "running soa_vector_test"                      && /bin/sh -c "${UNITEXEC} ./soa_vector_test")

if(WITH_CUDA)
  add_dependencies(check run_cuda_allocator_test)
  add_dependencies(check run_cuda_array_test)
  add_dependencies(check run_soa_array_cuda_test)
  add_dependencies(check run_soa_grid_cuda_test)
endif()
add_dependencies(check run_aligned_allocator_test)
add_dependencies(check run_api_traits_test)
add_dependencies(check run_estimate_optimum_short_vec_type_test)
add_dependencies(check run_loop_peeler_test)
add_dependencies(check run_preprocessor_test)
add_dependencies(check run_short_vec_test)
add_dependencies(check run_streaming_short_vec_test)
add_dependencies(check run_soa_array_test)
add_dependencies(check run_soa_grid_test)
add_dependencies(check run_soa_vector_test)

if(WITH_CUDA)
  add_dependencies(run_cuda_allocator_test                cuda_allocator_test)
  add_dependencies(run_cuda_array_test                    cuda_array_test)
  add_dependencies(run_soa_array_cuda_test                soa_array_cuda_test)
  add_dependencies(run_soa_grid_cuda_test                 soa_grid_cuda_test)
endif()
add_dependencies(run_aligned_allocator_test               aligned_allocator_test)
add_dependencies(run_api_traits_test                      api_traits_test)
add_dependencies(run_estimate_optimum_short_vec_type_test estimate_optimum_short_vec_type_test)
add_dependencies(run_loop_peeler_test                     loop_peeler_test)
add_dependencies(run_preprocessor_test                    preprocessor_test)
add_dependencies(run_short_vec_test                       short_vec_test)
add_dependencies(run_streaming_short_vec_test             streaming_short_vec_test)
add_dependencies(run_soa_array_test                       soa_array_test)
add_dependencies(run_soa_grid_test                        soa_grid_test)
add_dependencies(run_soa_vector_test                      soa_vector_test)

if(WITH_CUDA)
  add_dependencies(tests cuda_allocator_test)
  add_dependencies(tests cuda_array_test)
  add_dependencies(tests soa_array_cuda_test)
  add_dependencies(tests soa_grid_cuda_test)
endif()
add_dependencies(tests aligned_allocator_test)
add_dependencies(tests api_traits_test)
add_dependencies(tests estimate_optimum_short_vec_type_test)
add_dependencies(tests loop_peeler_test)
add_dependencies(tests preprocessor_test)
add_dependencies(tests short_vec_test)
add_dependencies(tests streaming_short_vec_test)
add_dependencies(tests soa_array_test)
add_dependencies(tests soa_grid_test)
add_dependencies(tests soa_vector_test)
